<?php
use yii\helpers\Html;
use yii\helpers\Url;
use app\lib\WeixinUtils;

/* @var $this yii\web\View */
/* @var $content string 字符串 */


$web = Url::to("@web");

?>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta content="telephone=no" name="format-detection">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <title>联盟榜</title>
    <script src="<?=$web?>/js/jquery.js"></script>
    <script src="<?=$web?>/js/tools.js"></script>
    <link href="<?=$web?>/css/fx/ranking-list.css" rel="stylesheet" type="text/css">
    <script>
        $(function ($) {
            var w = $(document).width();
            if (w > 640) {
                w = 640;
            }
            $("html").css("font-size", w * 20 / 320);
            loadRList();

//            var scrollTop = $(this).scrollTop();
//            var scrollHeight = $(window).height();
//            var contentHeight = $(this).height();
//            alert(scrollTop+"="+scrollHeight+"="+contentHeight);
            $(document).scroll(function () {
                var scrollTop = $(this).scrollTop();
                var scrollHeight = $(window).height();
                var contentHeight = $(this).height();
//              alert(scrollTop+"="+scrollHeight+"="+contentHeight);
                if (scrollTop + scrollHeight >= contentHeight) {
                    // alert(1);
                    loadRList();
                }
            });
        });





        var start = 0;
        var pagesize=6;

        var myResultList_tpl=returnstring('<?=$web?>/js/fx/fx-rank-list-2.tpl');
        function loadRList() {

            var data = {};
            data.start = start;
            data.pagesize = pagesize;


            var re = returnjson("<?=Url::to(['wx-fx/fx-rank2-handle'])?>", data);

            if (re.flag == 0) {
                alert(re.msg);
                return;
            } else {
                var target = $("#mylist");

                $.each(re.reList, function (i, item) {
                    var dom = document.createElement("div");
                    dom.innerHTML = myResultList_tpl._format({
                        rank:returnRank(start+i+1),
                        header_url:item.HEADER_URL,
                        nick_name:item.NICK_NAME,
                        val:item.VAL,
                        web:'<?=$web?>',

                    });
                    target.get(0).appendChild(dom);
                });

                start = start + re.reList.length;

            }

        }

        returnRank=function(rank){
            if(rank==1){
                return '<img src="<?=$web?>/img/fx/ranking-list-2.png">';
            }
            if(rank==2){
                return '<img src="<?=$web?>/img/fx/ranking-list-3.png">';
            }
            if(rank==3){
                return '<img src="<?=$web?>/img/fx/ranking-list-4.png">';
            }
            if(rank>3){
                return '<div class="list-ranking-words">'+rank+'</div>';
            }
        };
    </script>
</head>
<body>
<div class="main">
    <div class="head">
        <img src="<?=$web?>/img/fx/ranking-list-two-2.png">
    </div>

    <div class="me list">
        <div class="list-img">
            <img src="<?=$userinfo['HEADER_URL']?>">
        </div>
        <div class="list-words">
            <div class="list-words-name">
                <?=$userinfo['NICK_NAME']?>
            </div>
            <div class="list-words-foot">
                <div class="list-words-left">
                    距离您上一名还有<span><?=($my_top['mytopVal'] -$my_val) ?></span>米
                </div>
                <div class="list-words-right">
                    排名：<span><?=$my_top['mytopcount']+1?></span>
                </div>
            </div>
        </div>
        <div class="list-right">
            <div class="list-right-twoImg">
                <img src="<?=$web?>/img/fx/ranking-list-two-1.png">
            </div>
            <div class="list-right-twoWords">
                <?=$my_val?>
            </div>
        </div>
    </div>

    <div class="hr"></div>
    <div id="mylist">
    <!--<div class="one list">
        <div class="list-ranking">
            <img src="<?/*=$web*/?>/img/fx/ranking-list-2.png">
        </div>
        <div class="list-img">
            <img src="">
        </div>
        <div class="list-words list-words-other">
            我是大帅锅
        </div>
        <div class="list-right">
            <div class="list-right-twoImg">
                <img src="<?/*=$web*/?>/img/fx/ranking-list-two-1.png">
            </div>
            <div class="list-right-twoWords">
                000
            </div>
        </div>
    </div>

    <div class="two list">
        <div class="list-ranking">
            <img src="<?/*=$web*/?>/img/fx/ranking-list-3.png">
        </div>
        <div class="list-img">
            <img src="">
        </div>
        <div class="list-words list-words-other">
            我是大帅锅
        </div>
        <div class="list-right">
            <div class="list-right-twoImg">
                <img src="<?/*=$web*/?>/img/fx/ranking-list-two-1.png">
            </div>
            <div class="list-right-twoWords">
                000
            </div>
        </div>
    </div>

    <div class="three list">
        <div class="list-ranking">
            <img src="<?/*=$web*/?>/img/fx/ranking-list-4.png">
        </div>
        <div class="list-img">
            <img src="">
        </div>
        <div class="list-words list-words-other">
            我是大帅锅
        </div>
        <div class="list-right">
            <div class="list-right-twoImg">
                <img src="<?/*=$web*/?>/img/fx/ranking-list-two-1.png">
            </div>
            <div class="list-right-twoWords">
                000
            </div>
        </div>
    </div>

    <div class="list">
        <div class="list-ranking">
            <div class="list-ranking-words">4</div>
        </div>
        <div class="list-img">
            <img src="">
        </div>
        <div class="list-words list-words-other">
            我是大帅锅
        </div>
        <div class="list-right">
            <div class="list-right-twoImg">
                <img src="<?/*=$web*/?>/img/fx/ranking-list-two-1.png">
            </div>
            <div class="list-right-twoWords">
                000
            </div>
        </div>
    </div>

    <div class="other list">
        <div class="list-ranking">
            <div class="list-ranking-words">4</div>
        </div>
        <div class="list-img">
            <img src="">
        </div>
        <div class="list-words list-words-other">
            我是大帅锅
        </div>
        <div class="list-right">
            <div class="list-right-twoImg">
                <img src="<?/*=$web*/?>/img/fx/ranking-list-two-1.png">
            </div>
            <div class="list-right-twoWords">
                000
            </div>
        </div>
    </div>-->
     </div>
</div>
</body>
</html>